package cn.wolfcode.trip.app.controller;

        import cn.wolfcode.trip.app.util.UserContext;
        import cn.wolfcode.trip.base.domain.PictureShare;
        import cn.wolfcode.trip.base.service.IPictureShareService;
        import cn.wolfcode.trip.base.util.JSONResult;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.PostMapping;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.bind.annotation.RestController;
        import org.springframework.web.multipart.MultipartFile;

/**
 * @author Wangyk
 * @date 2019/1/15 14:39
 */
@RestController
@RequestMapping("pictureShare")
public class PictureShareController {
    @Autowired
    private IPictureShareService pictureShareService;

    /**
     * 添加一篇图片分享
     *
     * @param pictureShare 分享内容
     * @return 添加结果
     */
    @PostMapping
    public JSONResult addAPictureShare(PictureShare pictureShare) {
        JSONResult jsonResult = new JSONResult();
        try {
            //保存一个照片分享
            pictureShareService.saveAPictureShare(pictureShare, UserContext.getCurrentUser());
        } catch (Exception e) {
            jsonResult.mark(e.getMessage());
        }
        return jsonResult;
    }


}